Conversation
Helpful if the user has an old instance of wordpress that they aren't interested in.
a6cd9ff to
ad4c687
Compare
|
fuck lint |
jvperrin
left a comment
There was a problem hiding this comment.
Looks good to me, however the warning at the top of this file
Lines 20 to 22 in ad4c687
seems like it's wrong now (it'll ask to delete existing tables and not let you continue instead now), but I couldn't comment on that line itself since it's not in the diff.
| read -rp "Do you want to continue? [y/N] " wordpresskiller | ||
| wordpresskiller=${wordpresskiller,,} | ||
| if ! [[ "$wordpresskiller" =~ ^(yes|y) ]]; then | ||
| echo "If you want to run this script and keep the tables intact, rename the existing tables from wp_* to something else." |
There was a problem hiding this comment.
This seems like it would be useful before asking the user if they want to delete everything than at the stage when they have shied away from it, although it's useful here too I suppose so that they know what to do to continue to the later steps in the script.
| tables=$(mysql --user="$USER" --password="$sqlpass" --execute="show tables" "$USER" | grep -E "^wp_" || echo "") | ||
| if ! [[ -z "$tables" ]]; then | ||
| echo | ||
| echo -e "\033[33mThere appears to be an existing WordPress installation. Would you like to clean the database?\033[00m\n" |
There was a problem hiding this comment.
Print out the name of the tables to be deleted in here too? Then at least it might be clear if it's deleting tables that it shouldn't.
I'm unclear if this is too much information for the user, but given this is deleting those tables, it seems reasonable to me to list them first.
There was a problem hiding this comment.
I think it's pretty reasonable to delete everything that starts with wp_ without listing them. We don't really want to overload users.
| tables=$(mysql --user="$USER" --password="$sqlpass" --execute="show tables" "$USER" | grep -E "^wp_" || echo "") | ||
| if ! [[ -z "$tables" ]]; then | ||
| echo | ||
| echo -e "\033[33mThere appears to be an existing WordPress installation. Would you like to clean the database?\033[00m\n" |
There was a problem hiding this comment.
I think it's pretty reasonable to delete everything that starts with wp_ without listing them. We don't really want to overload users.
| fi | ||
|
|
||
| echo "$tables" | tr ' ' '\n' | while read -r table; do | ||
| mysql --user="$USER" --password="$sqlpass" --execute="DROP TABLE $table" "$USER" |
There was a problem hiding this comment.
I think we should use mysqldump to back up the tables before dropping them.
Helpful if the user has an old instance of wordpress that they aren't
interested in.